#include<iostream>
#include<string>
using namespace std;

int firstUniqChar(string s) {
    int arr[26] = {0};
    int length = s.size();
    for (int i = 0; i < length; ++i)
    {
        arr[s[i] - 'a']++;
    }
    string only;
    int number = -1;
    for (int i = 0; i < 26; ++i)
    {
        if (arr[i] == 1)
        only += (char)(i) + 'a';
    }
    number = s.find_first_of(only);
    return number;
}

int main()
{
    string s = "leetcodre";
    firstUniqChar(s);
	return 0;
}